package cn.ilikes.tools.logs;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

public class Loggerfactory {

	private static final boolean print = false;

	public static <T> Logger instance(Class<T> clazz) {
		return LoggerFactory.getLogger(clazz);
	}

	public static void info(Logger logger, String message) {
		if (logger.isInfoEnabled())
			logger.info(" - > " + message);
	}

	public static void infoDebug(Logger logger, String message) {
		logger.info("info debug =>  " + message);
	}

	public static void error(Logger logger, String message, Throwable exception) {

		{
			if (logger.isWarnEnabled()) {
				if (exception == null)
				{
					
				}
//					logger.error("***************************** = > " + message);
				else {
					exception.printStackTrace();
					logger.error(message, exception);
				}
			}
		}

	}

	public static void error(Logger logger, Throwable exception) {

		{
			if (logger.isWarnEnabled()) {
				if (exception == null) {
					
				} else {
					exception.printStackTrace();

					logger.error(exception.getMessage(), exception);
				}
			}
		}

	}

	public static boolean isdebug(Logger logger) {
		return logger.isDebugEnabled();
	}

	public static void error(Logger logger, String message) {
		error(logger, message, null);

	}

	public static void warn(Logger logger, String message) {

		logger.warn(message);

	}

	public static void debug(Logger logger, String message, Throwable exception) {

		logger.debug(message, exception);
		if (exception != null)
			exception.printStackTrace();

	}

	public static void debug(Logger logger, String message) {

		logger.debug(message);

	}

	public static boolean isPrint() {
		return true;
	}

	public static void print(Object message) {
		if (print)
			System.out.println("bug-------------> <--- ------:" + message);
	}

}
